package com.zw.cloud.tools.controller.ai;

import com.zw.cloud.global.response.wrapper.entity.WebResult;
import com.zw.cloud.tools.service.AliyunTalkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ai/aliyun/talk")
public class AliyunTalkController {

    @Autowired
    private AliyunTalkService aliyunTalkService;

    /**
     * 通义千问
     * https://help.aliyun.com/zh/dashscope/developer-reference/api-details?spm=a2c4g.11186623.0.0.774416e9YTvxyH#p3drW
     */
    @GetMapping("/{userId}/{query}")
    //http://localhost:9040/ai/aliyun/talk/1/can you help me
    public WebResult<String> talk(@PathVariable String userId, @PathVariable String query) throws Exception {
        return WebResult.success(aliyunTalkService.talk(userId,query));
    }
}
